import java.util.HashSet;
import java.util.Set;

/**
 * @author LKQ
 * @date 2022/2/15 16:43
 * @description
 */
public class Solution {
    public static void main(String[] args) {

    }

    private static String[] strings = {".-","-...","-.-.","-..",".","..-.","--.","....",
            "..",".---","-.-",".-..","--","-.","---",".--.",
            "--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};


    public int uniqueMorseRepresentations(String[] words) {
        Set<String> set = new HashSet<>();
        for (String word: words) {
            StringBuffer sb = new StringBuffer();
            for (char c: word.toCharArray()) {
                sb.append(strings[c - 'a']);
            }
            set.add(sb.toString());
        }
        return set.size();
    }
}
